package com.hibase.core.interfacetask.service;


import com.github.pagehelper.PageInfo;
import com.hibase.core.interfacetask.entity.MdsInterfaceTask;
import com.hibase.core.interfacetask.entity.MdsInterfaceType;
import com.hibase.core.interfacetask.entity.vo.MdsInterfaceTaskSearchVO;
import com.hibase.core.interfacetask.entity.vo.MdsInterfaceTaskThirdCallVO;
import com.hibase.core.mybatis.service.BaseService;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author hufeng
 * @since 2019-04-29
 */
public interface IMdsInterfaceTaskService extends BaseService<MdsInterfaceTask> {

    /**
     * 查询未处理的任务
     *
     * @return
     */
    List<MdsInterfaceTask> selectNotDealList(Map<String, Object> map);


    /**
     * 查询接口任务表列表
     *
     * @param searchVO
     * @return
     */
    PageInfo<MdsInterfaceTask> selectMdsInterfaceTaskList(MdsInterfaceTaskSearchVO searchVO);

    /**
     * 改变接口任务表记录
     *
     * @param entity
     * @return
     */
    void saveMdsInterfaceTask(MdsInterfaceTask entity);

    /**
     * 查询接口任务表详情
     *
     * @param id
     * @return
     */
    MdsInterfaceTask viewMdsInterfaceTask(String id);

    /**
     * 立即执行接口
     * @param ids
     * @return
     */
    String executeTask(List<String> ids);

    /**
     * 异步调用
     * @param mdsInterfaceTaskThirdCallVO
     */
    String asyncCall(MdsInterfaceTaskThirdCallVO mdsInterfaceTaskThirdCallVO, String topicName);

    String asyncCall(MdsInterfaceTask task);

    /**
     * 同步调用
     * @param mdsInterfaceTaskThirdCallVO
     */
    String syncCall(MdsInterfaceTaskThirdCallVO mdsInterfaceTaskThirdCallVO);

    /**
     * 调用第三方接口，执行URL
     * @param task
     * @return
     */
    MdsInterfaceTask execUrl(MdsInterfaceTask task);

    MdsInterfaceTask storeByNewTransactional(MdsInterfaceTask task);

    void saveTask(MdsInterfaceTaskThirdCallVO interfaceTaskVO, MdsInterfaceTask entity, MdsInterfaceType interfaceType);

    void ignore(List<String> ids, String remarks);

    void failedRetry(MdsInterfaceTask mdsInterfaceTask);

}
